home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DDJMAG / DDJ8801.ZIP / NARO.ZIP / PRINTLOC.C < prev    next >
Text File  |  1987-10-30  |  2KB  |  79 lines

  1. /*
  2.     Copyright (C) 1987 Paradigm Systems Inc.  All rights reserved.
  3. */
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <time.h>
  9.  
  10. #include "loc.h"
  11. #include "externs.h"
  12.  
  13.  
  14. int    print_statistics(map_filename, stat_filename, command_line, \
  15.         exename, output_file, configname, entry_point)
  16. char    *map_filename ;
  17. char    *stat_filename ;
  18. char    *command_line ;
  19. char    *exename ;
  20. char    *output_file ;
  21. char    *configname ;
  22. unsigned char    *entry_point ;
  23. {
  24.     unsigned long    temp ;
  25.     long    ltime ;
  26.     int    i ;
  27.     SEG_DESCRIPTOR    *p ;
  28.     SYMBOL_LIST    *q ;
  29.  
  30.     /*
  31.         This function generates the locate map file.  The locate map
  32.         file contains the segment information with the physical
  33.         segment addresses.
  34.     */
  35.  
  36.     fprintf(print_file, "MS-DOS Locate Utility Version 1.0\n\n") ;
  37.     fprintf(print_file, "Input File: %s\n", exename) ;
  38.     fprintf(print_file, "Output File: %s\n", output_file) ;
  39.     fprintf(print_file, "Configuration File: %s\n", configname) ;
  40.     fprintf(print_file, "Invoked by: %s\n", command_line) ;
  41.  
  42.     time(<ime) ;
  43.     fprintf(print_file, "Date/Time: %s\n", ctime(<ime)) ;
  44.  
  45.     /* Display the located segment information */
  46.     fprintf(print_file, "Segment Information\n");
  47.     fprintf(print_file, "%-16s%-16s%-12s%-12s\n", "Name", "Class",
  48.                     "Address", "Length");
  49.  
  50.     p = seg_list ;
  51.     while (p != NULL)   {
  52.         temp = (unsigned long) p->pseg ;
  53.         temp = temp * 16 + p->offset ;
  54.         fprintf(print_file, "%-16s%-16s%05lXH%10.04XH\n", p->name,
  55.                         p->class, temp, p->len) ;
  56.         p = p->next ;
  57.     }
  58.  
  59.     /* Display the symbol information */
  60.     fprintf(print_file, "\n\nPublic Symbols\n");
  61.     i = 0 ;
  62.     p = seg_list ;
  63.     while (p != NULL)   {
  64.         q = p->symbol_list ;
  65.         while (q != NULL)   {
  66.             fprintf(print_file, "%04X:%04X  %-16s%s", p->pseg,
  67.                             q->value, q->name, i++ ? "\n" : "\t\t") ;
  68.             i %= 2 ;
  69.             q = q->next ;
  70.         }
  71.         p = p->next ;
  72.     }
  73.  
  74.     fprintf(print_file, "%sEntry Point - %p\n", (i == 1) ? "\n\n" : "\n",
  75.                     entry_point) ;
  76.  
  77.     return ;
  78. }
  79.